package com.turing.post.common.util;

import java.math.BigInteger;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Table;

/**
 * @服务控制表
 * @author zxp
 * @date 2012-12-14
 */
@SuppressWarnings("serial")
@Entity
@Table(name = "SysOpAcl")
@IdClass(SysOpAcl.class)
public class SysOpAcl implements java.io.Serializable {

	/**
	 * 角色编号
	 */
	private BigInteger roleId;
	/**
	 * 服务编号
	 */
	private BigInteger sapId;

	public SysOpAcl() {
		super();
	}

	@Id
	@Column(name = "RoleId", nullable = false)
	public BigInteger getRoleId() {
		return roleId;
	}

	public void setRoleId(BigInteger roleId) {
		this.roleId = roleId;
	}

	@Id
	@Column(name = "SapId", nullable = false)
	public BigInteger getSapId() {
		return sapId;
	}

	public void setSapId(BigInteger sapId) {
		this.sapId = sapId;
	}

	public boolean equals(Object other) {
		if ((this == other))
			return true;
		if ((other == null))
			return false;
		if (!(other instanceof SysOpAcl))
			return false;
		SysOpAcl castOther = (SysOpAcl) other;

		return ((this.getRoleId() == castOther.getRoleId()) || (this
				.getRoleId() != null
				&& castOther.getRoleId() != null && this.getRoleId().equals(
				castOther.getRoleId())))
				&& ((this.getSapId() == castOther.getSapId()) || (this
						.getSapId() != null
						&& castOther.getSapId() != null && this.getSapId()
						.equals(castOther.getSapId())));
	}

	public int hashCode() {
		int result = 17;
		result = 37 * result
				+ (getRoleId() == null ? 0 : this.getRoleId().hashCode());
		result = 37 * result
				+ (getSapId() == null ? 0 : this.getSapId().hashCode());
		return result;
	}
}